package EXam.Question15;
/**
 *
 这里面自定义排序规则还有社会么其他的方式
 */

import java.util.TreeSet;

public class Student999Test {
    public static void main(String[] args) {
        TreeSet<Student999> studentSet = new TreeSet<>();

        Student999 student1 = new Student999("爱迪生", 90, 55);
        Student999 student2 = new Student999("牛顿", 100, 90);
        Student999 student3 = new Student999("拉瓦锡", 70, 100);
        Student999 student4 = new Student999("霍金", 100, 100); // Fixed the syntax error
        Student999 student5 = new Student999("伽利略", 60, 85);
        Student999 student6 = new Student999("达尔文", 70, 75);

        studentSet.add(student1);
        studentSet.add(student2);
        studentSet.add(student3);
        studentSet.add(student4);
        studentSet.add(student5);
        studentSet.add(student6);

        // 4. 遍历集合打印所有元素信息
        System.out.println("按总分从高到低排序，总分相同时按物理成绩从高到低排序：");
        for (Student999 student : studentSet) {
            System.out.println(student);
        }
    }

}
